package com.auth.manage.web.vo;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result<T> {
    private T data;
    private Boolean success;
    private String code;
    private String msg;

    public static Result success(){
        return Result.builder().success(true).build();
    }

    public static <T> Result success(T data){
        return Result.builder().success(true).data(data).build();
    }

    public static <T> Result fail(){
        return Result.builder().success(false).build();
    }

    public static <T> Result error(String code, String msg){
        return Result.builder().success(false).code(code).msg(msg).build();
    }
}
